﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Serilog;
using Serilog.Core;
using SimpleTool.SerialTool;
using SimpleTool.Server;

namespace SimpleTool.ActivityUnit
{
    /// <summary>
    /// Activity.xaml 的交互逻辑
    /// </summary>
    public partial class ActivityUI : UserControl
    {
        public readonly Serilog.ILogger Logger = Log.ForContext<ActivityUI>();

        public ActivityUI()
        {
            InitializeComponent();
            App MyApp = (App)Application.Current;

            ActivityViewModel HoldViewModel = MyApp.ServiceProvider.GetRequiredService<ActivityViewModel>();

            IPowerPlantServer PowerPlant = MyApp.ServiceProvider.GetRequiredService<IPowerPlantServer>();

            DataContext = HoldViewModel;

            PowerPlant.Read<ActivityViewModel>(HoldViewModel.SerialDataReceive);
        }
    }
}
